<%@ include file="/en/jsp/static.jsp" %>
<%@ page import="java.util.*, linuxbox.filelib.logic.*,linuxbox.admin.logic.*,linuxbox.admin.bean.*" %>
<%@ taglib uri="/linuxbox/common.tld" prefix="common" %>

<jsp:include page="/en/jsp/header.jsp" flush="true"/>

<%
  FileLibHome home = FileLibHome.getInstance();
  FileLibEntry entry = (FileLibEntry)session.getAttribute("filelib.CURENTRY");
  if (entry == null)
  {
    pageContext.forward(BoxStatic.errorJSP);
    return;
  }
  if (entry.getID() != -1 )
  {
    if (!home.checkAccessRights(curID, entry, home.WRITE_ALLOW))
    {
      pageContext.forward(BoxStatic.accessRightErrorJSP);
      return;
    }
  }

  UserManager um = UserManager.getInstance();
  User user = null;
  boolean bInherit = ((entry.getAttributes() & home.INHERIT) != 0);
  String location = home.getPathString(entry.getParent());
  String inheritEntryName = null;
  String curEntryName = null;
  Collection parentPermissions = null;
  if (entry.getID() == home.ROOT)
    parentPermissions = home.getPermissionList(entry);
  else
    parentPermissions = home.getPermissionList(home.get(entry.getParent()));
  Collection curPermissions = home.getPermissionList(entry);

%>

<table width="100%" height=26 align=middle border=0 cellpadding=0 cellspacing=0 bgcolor="#f4f4f4" style="font-size:16px;color:#d05000">
  <tr>
    <td>
	    &nbsp;<img src="<%=BoxStatic.imageDir%>itemball.jpg" width=14 height=15 border=0 align="absmiddle">
	    <b><%=boxName%> - File Library&nbsp; - Edit Folder</b>
    </td>
    <td align=right>
      <a href="<%=BoxStatic.servletDir%>BoxFileLibSettingsAction?SubmitEdit=edit">
        Settings
      </a>
    </td>
  </tr>
</table>
<hr width=\"100%\" color=#E06000 align=left>

<form action="<%=BoxStatic.servletDir%>EditFolderAction" method=post>
  <table width= "100%" border=1 cellspacing=0 cellpadding=1>
    <tr><td>
            <input type=submit value=
<%
      if (entry.getID()==-1)
        out.println("\"Add\" name=SubmitSave onclick=\"onSubmit()\"");
      else
      {
        out.println("\"Update\" name=SubmitSave onclick=\"onSubmit()\">");
        out.println("<input type=submit value=\"Delete\" name=SubmitAskDelete");
      }
%>
            >
            <input type="button" value="Cancel" onclick="window.location='<%=BoxStatic.servletDir%>FolderContentAction?FOLDERID=<%
                if (entry.getID() == -1)
                  out.print(entry.getParent());
                else
                  out.print(entry.getID());
              %>'" >
          </td></tr>    <tr><td>
      <table border=0 width="100%" bgcolor=#e0e0e0 style="font-size:14px">
          <input type=hidden name=ID value=<%=entry.getID()%>>
    <TR  bgcolor="#7EC1F3" >
      <TD colSpan=2> <b><font size="+1">General:</font></b>
      </TD>
    </TR>

          <tr><td>
            Folder Location: <b> <%=location%> </b>
          </td></tr>
          <tr>
            <td>Folder Name: <input type=text name=NAME size=40 value="<%=((entry.getName()==null)?"":entry.getName())%>"></td>
          </tr>
          <tr><td>
            <b><INPUT TYPE="checkbox" name="READONLY" value="1"
              <% if ((entry.getAttributes()&home.READONLY) != 0)
                   out.print(" checked ");
              %>
              >Readonly</b>&nbsp;&nbsp;Owner: <b><%=um.getUserDisplayName(entry.getOwnerid(), um.USERNAME_FORMAT_ALL)%></b>
          </td></tr>
          <tr><td>
            <b>Description:</b><br>
            <textarea name=DESCRIPTION rows=5 cols=60><%=((entry.getDescription()==null)?"":entry.getDescription())%></textarea><br>
          </td></tr>

 <%@include file="SecurityEdit.jsp" %>

      </table>
    </td></tr>
    <tr><td>
            <input type=submit value=
<%
      if (entry.getID()==-1)
        out.println("\"Add\" name=SubmitSave onclick=\"onSubmit()\"");
      else
      {
        out.println("\"Update\" name=SubmitSave onclick=\"onSubmit()\">");
        out.println("<input type=submit value=\"Delete\" name=SubmitAskDelete");
      }
%>
            >
            <input type="button" value="Cancel" onclick="window.location='<%=BoxStatic.servletDir%>FolderContentAction?FOLDERID=<%
                if (entry.getID() == -1)
                  out.print(entry.getParent());
                else
                  out.print(entry.getID());
              %>'" >
          </td></tr>  </table>
</form>

  <hr width=\"100%\" color=#E06000 align=left>

<jsp:include page="/en/jsp/footer.jsp" flush="true"/>
